#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<errno.h>
#include<fcntl.h>
#include<sys/stat.h>
#include<unistd.h> 
#include<pthread.h>


int
main(int argc, char* args[])
{
	struct stat* sbuf = new struct stat();
	
	if(stat(args[1], sbuf) < 0){ 
		perror("stat error");
		exit(1);
}
	
	printf("file size is %d\n", sbuf->st_size);
	if(S_ISREG(sbuf -> st_mode)){
		printf("file is a regular\n");
	}
	else if(S_ISDIR(sbuf -> st_mode)){
		printf("file is a dir\n");
	}

	delete sbuf;
	
	return 0;	
}
